﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using HA.MT3DMS.DomainLayer;
namespace HA.ModFlow.Controls.Converts
{
    class Mt3dIsoTHMConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ISOTHMType type = (ISOTHMType)value;
            int index = 0;
            switch (type)
            {
                case ISOTHMType.NOSorption:
                    index = 0;
                    break;
                case ISOTHMType.LinearIsoTherm:
                    index = 1;
                    break;
                case ISOTHMType.FreundlichIsoTherm:
                    index = 2;
                    break;
                case ISOTHMType.LangmuirIsoTherm:
                    index = 3;
                    break;
                case ISOTHMType.FirstOrderKineticSorption:
                    index = 4;
                    break;
                case ISOTHMType.DualDomainTransferWithoutSorption:
                    index = 5;
                    break;
                case ISOTHMType.DualDomainTransferWithSorption:
                    index = 6;
                    break;
            }
            return index;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int index = (int)value;
            ISOTHMType type = ISOTHMType.NOSorption;
            switch (index)
            {
                case 0:
                    type = ISOTHMType.NOSorption;
                    break;
                case 1:
                    type = ISOTHMType.LinearIsoTherm;
                    break;
                case 2:
                    type = ISOTHMType.FreundlichIsoTherm;
                    break;
                case 3:
                    type = ISOTHMType.LangmuirIsoTherm;
                    break;
                case 4:
                    type = ISOTHMType.FirstOrderKineticSorption;
                    break;
                case 5:
                    type = ISOTHMType.DualDomainTransferWithoutSorption;
                    break;
                case 6:
                    type = ISOTHMType.DualDomainTransferWithSorption;
                    break;
            }
            return type;
        }
    }
}
